examples: Fix multiple small problems
authorMatthias Clasen <mclasen@redhat.com>
Thu, 13 Aug 2020 21:30:47 +0000 (17:30 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 13 Aug 2020 21:30:47 +0000 (17:30 -0400)
Add a paragraph about running the example apps
uninstalled in the README, and verify that the
standalone Makefiles actually work. Hint: some
didn't.

examples/README
examples/application4/Makefile.example
examples/application5/Makefile.example
examples/application6/Makefile.example
examples/application8/exampleappwin.c
examples/application9/exampleappwin.c

index ab70ec382cc9c437677d8e9e6ca6b215ab81cfa2..44ce0bd734f53b91b1c88ab3da2f97275d7eb09f 100644 (file)
@@ -4,9 +4,20 @@
 
 The examples in this directory are built alongside the rest of GTK.
 
-The examples under the `application[1-10]` directories are also included in
+The examples under the `application[1-9]` directories are also included in
 the GTK API reference documentation, and can be built independently, using
 the system libraries, by doing:
 
     $ cd application1
     $ make -f Makefile.example
+
+== Running the examples ==
+
+The examples can be run uninstalled.
+
+The later demos are using GSettings,so they need a GSettings schema.
+The code for these demos contains a workaround to look for the schema
+in the current directory, so this works:
+
+    $ cd application5
+    & ./exampleapp window.ui
index 97af3fca29c1bd89341b380b2d253735a4ab872a..5b81fedf0722da568b1c8576cc3b168434192ffa 100644 (file)
@@ -11,7 +11,7 @@ OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
 
 all: exampleapp
 
-resources.c: exampleapp.gresource.xml window.ui app-menu.ui
+resources.c: exampleapp.gresource.xml window.ui
        $(GLIB_COMPILE_RESOURCES) exampleapp.gresource.xml --target=$@ --sourcedir=. --generate-source
 
 %.o: %.c
index ac7ae85bd309133032637653bd1eaa7aa414561c..1090c73012ea175c70ec9f84b57513afd4499de7 100644 (file)
@@ -18,7 +18,7 @@ org.gtk.exampleapp.gschema.valid: org.gtk.exampleapp.gschema.xml
 gschemas.compiled: org.gtk.exampleapp.gschema.valid
        $(GLIB_COMPILE_SCHEMAS) .
 
-resources.c: exampleapp.gresource.xml window.ui app-menu.ui
+resources.c: exampleapp.gresource.xml window.ui
        $(GLIB_COMPILE_RESOURCES) exampleapp.gresource.xml --target=$@ --sourcedir=. --generate-source
 
 %.o: %.c
index 0a8a3db3551adfcb2c1395caa4d97e01e6ff9e7f..eb9d43ce57c0bb91954d05c1ec1c0950f41058e8 100644 (file)
@@ -18,7 +18,7 @@ org.gtk.exampleapp.gschema.valid: org.gtk.exampleapp.gschema.xml
 gschemas.compiled: org.gtk.exampleapp.gschema.valid
        $(GLIB_COMPILE_SCHEMAS) .
 
-resources.c: exampleapp.gresource.xml window.ui app-menu.ui
+resources.c: exampleapp.gresource.xml window.ui
        $(GLIB_COMPILE_RESOURCES) exampleapp.gresource.xml --target=$@ --sourcedir=. --generate-source
 
 %.o: %.c
index a598de13e00e84a79138d4717069c37e7f20bf84..b623c3d0a8cab8132d9a91d013629e20e9a08208 100644 (file)
@@ -107,7 +107,7 @@ done:
       row = gtk_button_new_with_label (key);
       g_signal_connect (row, "clicked",
                         G_CALLBACK (find_word), win);
-      gtk_box_append (GTK_BOX (win->words), row);
+      gtk_list_box_insert (GTK_LIST_BOX (win->words), row, -1);
     }
 
   g_hash_table_unref (strings);
index a775f5b08af788915c2785a936ba279bea5b325a..0edfa2cea112b0f9267de76f63b83af4982f0c88 100644 (file)
@@ -109,7 +109,7 @@ done:
       row = gtk_button_new_with_label (key);
       g_signal_connect (row, "clicked",
                         G_CALLBACK (find_word), win);
-      gtk_box_append (GTK_BOX (win->words), row);
+      gtk_list_box_insert (GTK_LIST_BOX (win->words), row, -1);
     }
 
   g_hash_table_unref (strings);